$(function(){

        var largeImg = new Vue({
            el:"#largeImgModal",
            data:{
                imgUrl : "image/header.png",
                index: "",
                imgIndex:"",
            },
            methods:{
                // setLargeImgSize: setLargeImgSize,
                nextImg:function(){
                    var count = text.largeUrls.length;

                    if(parseInt(this.imgIndex)+1 >= count){
                        this.imgIndex = 0;
                    }else{
                        this.imgIndex ++;
                    }

                    // this.setLargeImgSize(blogInfo,this.index,this.imgIndex);
                    this.imgUrl = text.largeUrls[this.imgIndex];
                },
                prevImg:function(){
                    var count = text.largeUrls.length;
                    if(parseInt(this.imgIndex)- 1 < 0){
                        this.imgIndex = count-1;
                    }else{
                        this.imgIndex --;
                    }
                    // this.setLargeImgSize(blogInfo,this.index,this.imgIndex);
                    this.imgUrl = text.largeUrls[this.imgIndex];
                },
                btnIn:function(type){
                    switch(parseInt(type)){
                        case 0:
                            $('#largeImgModal .right-btn').css({'color':'rgba(255,255,255,1)'});
                            break;
                        case 1:
                            $('#largeImgModal .left-btn').css({'color':'rgba(255,255,255,1)'});
                            break;
                    }
                },
                btnOut: function(type){
                    switch(parseInt(type)){
                        case 0:
                            $('#largeImgModal .right-btn img').attr('src','image/largeRightActive.png');
                            break;
                        case 1:
                            $('#largeImgModal .left-btn img').attr('src','image/largeLeftActive.png');
                            break;
                        case 2:
                            $('#largeImgModal .close-btn img').attr('src','image/largeCloseActive.png');
                            break;
                    }
                }
            },

        });

    //获取 文章类型  4：精选资讯   5：技术分析
    // 获取  文章ID

    //资讯详情
    var text = new Vue({
        el: '#block-information',
        data:{
            id:"",
            infoType:"",
            isFollow: "",
            followId:"",
            followMsg:'',
            title:"",
            username:"",
            userId:0,
            userImg:"image/header.png",
            seeNum:0,
            time:"",
            source:"",
            content:'',
            urls:[],
            urlsGeo:[],
            largeUrls:[],
            largeUrlsGeo:[],
            largeImg: "", //记录大图对象
            good:0,
            bad:0,
            blocks:[], //下方币种列表
        },
        methods:{
            //点击头像调用 个人主页
            goPersonalMain: function(event){
                // var type =  $('#information-list .nav-active').attr('type');
                var type = getUrlParams().type;
                var id = event.currentTarget.getAttribute('value');
                // location.href="personalMain.html?id="+id;
                window.open("personalMain.html?id="+id+'&type=2');
            },
            //浏览大图
            toLargeImg: showLargeImg,
            //显示共享框
            toShare:showShare,
            //根据类型选择对应的分享方式
            toShareType:shareType,
            //鼠标移出关闭共享框
            closeShare: closeShare,
            hightShow: function(type,event){
                switch(type){
                    case 0:
                        event.currentTarget.setAttribute('src','image/zuoActive.png');
                        break;
                    case 1:
                        event.currentTarget.setAttribute('src','image/youActive.png');
                        break;
                }

            },
            remHightShow: function(type,event){
                switch(type){
                    case 0:
                        event.currentTarget.setAttribute('src','image/zuo.png');
                        break;
                    case 1:
                        event.currentTarget.setAttribute('src','image/you.png');
                        break;
                }

            },
            //设置关注
            setFollow:function(event){
                if(isLogin()){
                    if(this.isFollow){
                        // var id  = event.currentTarget.getAttribute('value');
                        var data = {
                            followId: this.followId, //	关注ID	是	2	String
                            element: this,
                        };
                        removeAuthorsFollow(data);
                    }else{
                        // var id  = event.currentTarget.getAttribute('value');
                        var data = {
                            sourceId: this.userId, //	文章作者编号	是	30	String
                            infoType: this.infoType, //	资讯类型	是	2	Number	2 weibo 3 twitter 4 精选资讯 5 技术分析
                            element: this,
                        };
                        addAuthorsFollow(data);
                    }

                }else{
                    location.href = 'login.html';
                }
            },
            //跳转货币详细页
            goCurrencyProfile: function(event){
                var id = event.currentTarget.getAttribute('value');
                // location.href = 'currencyProfile.html?id='+id;
                // window.open( 'currencyProfile.html?id='+id);
                var symbol = event.currentTarget.getAttribute('symbol');
                var url = event.currentTarget.getAttribute("url");
                if (url) {
                    location.href = "currencies/" + url;
                } else {
                    location.href = 'currencyProfile.html?id='+id+'&content='+symbol;
                }
            },
            //利好利空
            setUpDown:function(event){
                if(isUpdate){
                    isUpdate = false;
                    var id = event.currentTarget.getAttribute('value'); //文章ID
                    var type = event.currentTarget.getAttribute('type');  //利好 0    利空 1
                    // var index = event.currentTarget.getAttribute('index'); //数组索引
                    //更新利好利空
                    updateUpDown({url:'zan' ,infoType:2 , flag:type,id: id,element:this,currEvent: event.currentTarget});
                }

            },
            //走势图
            drawFlow: function(id,data,date,min,max){
                // 走势图
                if(id){
                    var myFlow = echarts.init(document.getElementById(id));
                    // var date = ['10-1','10-2','10-3','10-4','10-5'];
                    // var data = [-1.1,-3.0, 4, 2, 4, -2.2, 1, 1.6, 3.4];

                    var flowOption = {
                        grid: { //内部填充距离
                            left: '0%',
                            right: '0%',
                            top:'2%',
                            bottom: '0%',
                            containLabel: true
                        },
                        xAxis: {
                            type: 'category',
                            boundaryGap: false,
                            axisLine:{
                                show:false,
                            },
                            axisTick:{  //刻度线
                                show:false,
                            },
                        },
                        yAxis: {
                            type: 'value',
                            min: min,
                            max: max,
                            boundaryGap: false,
                            axisLine:{
                                show:false,
                            },
                            axisTick:{  //刻度线
                                show:false,
                            },
                            axisLabel:{
                                show:false,
                            },
                            splitLine:{
                                show:false,
                            }
                        },
                        visualMap: {
                            show: false,
                            // type: 'piecewise',
                            // seriesIndex:1,//控制series 对应的区域
                            // dimension: 1,
                            // yAxisIndex: 1,
                            pieces:[ {
                                lte: 0,
                                gt:-100,
                                color: "rgba(253, 120, 137, 1)",
                            }],
                            outOfRange: {
                                color: 'rgba(97, 217, 175, 1)',
                            },
                            backgroundColor:"red",
                        },

                        series: [{
                            smooth:true, //折线圆弧度
                            symbol: "none",//去掉折线圆点

                            sampling: 'average', //数据多余像素点时的显示
                            // data: [-1.1,-3.0, 4, 2, 4, -2.2, 1, 1.6, 3.4],
                            data: data,
                            // markLine:{
                            //     silent:false,
                            //     data:[{yAxis:0},]
                            // },
                            // data:[1,40,13,80,50,-60,-30],
                            type: 'line',
                            areaStyle: {
                                color:'rgba(97, 217, 175, 0.3)',
                                origin: 'auto',
                            },
                            // itemStyle : {
                            //     normal : {
                            //         lineStyle:{  //折线样式
                            //             color:'rgba(97, 217, 175, 1)',
                            //             width:2,
                            //         }
                            //     }
                            // }
                        },]
                    };


                    // 使用刚指定的配置项和数据显示图表。
                    myFlow.setOption(flowOption,true);
                }


            },
        },
        mounted:function(){
            this.$nextTick(function(){
                // addLoad(this.loadData);
                var args = getUrlParams();
                var id = args.id;
                getDynamicText({id:id,element: text});


                text.largeImg = largeImg;
            });

        }
    });


    //右侧
    var n = new Vue({
        el: '#news-information',
        data:{    },
        components:{
            // 'notice-content': noticeFullComponent, //交易所公告
            // 'up-down-content': upDownFullComponent, //24H涨跌榜
            'hot-content':hotFullComponent,  //热门资讯
        },
        methods:{   },

    });

});